/* 
 * File:   JRepositoryOperationResult.cpp
 * Author: johnneyshi
 * 
 * Created on 2013年4月23日, 下午1:20
 */

#include "JRepositoryOperationResult.h"

int JRepositoryOperationResult::PackStubMessage(JInOutPut& _strea, int& _allSize)
{
    int classSize = 0,selfSize = 0;
    JSerialize::SerializeHead(_strea,selfSize,classSize);
    JSerialize::Serialize(_strea,result,classSize);
    JSerialize::Serialize(_strea,message,classSize);
    return JSerialize::SerializeTail(_strea,_allSize,selfSize,classSize);
}

int JRepositoryOperationResult::UnPackStubMessage(JInOutPut& _strea)
{
    int classSize = JSerialize::ReSerializeHead(_strea);
    result = (JRepositoryOperationResultEnum)JSerialize::ReSerializeInt(_strea);
    message = JSerialize::ReSerializeString(_strea);
    return classSize;
}

int JRepositorySearchResult::PackStubMessage(JInOutPut& _strea, int& _allSize)
{
    int classSize = 0,selfSize = 0;
    JSerialize::SerializeHead(_strea,selfSize,classSize);
    JSerialize::Serialize(_strea,fileOrDir,classSize);
    JSerialize::Serialize<JDir>(_strea,listDir,classSize);
    JSerialize::Serialize<JFile>(_strea,listFile,classSize);
    return JSerialize::SerializeTail(_strea,_allSize,selfSize,classSize);
}

int JRepositorySearchResult::UnPackStubMessage(JInOutPut& _strea)
{
    int classSize = JSerialize::ReSerializeHead(_strea);
    fileOrDir = JSerialize::ReSerializeString(_strea);
    listDir = JSerialize::ReSerializeList<JDir>(_strea);
    listFile = JSerialize::ReSerializeList<JFile>(_strea);
    return classSize;
}